package com.bit.aop.aspect;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

//进行实现一个注解的具体逻辑；
@Aspect
@Component
@Slf4j
public class MyAspectDemo {
    @Around("@annotation(com.bit.aop.aspect.MyAspect)")
    public Object recordTime(ProceedingJoinPoint pjp){
        log.info("目标方法执行之前；...");
        Object result=null;
        try {
            result=pjp.proceed();
        }catch(Throwable e){
            log.error("do Around throwing...");
        }
        log.info("目标方法执行之后.....");
        return result;

    }
}
